package com.share.shareplatform.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.sql.Timestamp;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoodsOneComment {
    private Long id;
    private Long userId;//用户id
    private Long goodsId;//商品id

    @NotBlank(message = "评论信息不能为空")
    @Length(max = 100,message = "评论信息过长")
    private String message;//评论信息
    private Timestamp time;//评论时间
    private Integer click;//点赞数

    private User user;
    private List<GoodsTwoComment> goodsTwoCommentList;

    public static void setInit(GoodsOneComment comment){
        comment.setTime(new Timestamp(System.currentTimeMillis()));
        comment.setClick(0);

    }
}
